package com.cqs.leetcode.offerII;

import java.util.Map;

/**
 * xw
 * 2022/10/2
 */
public class OfferII008 {

    public int minSubArrayLen0(int target, int[] nums) {
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < nums.length; i++) {
            int sum = 0;
            for (int j = i; j < nums.length; j++) {
                sum += nums[j];
                if (sum >= target) {
                    min = Math.min(min, j - i + 1);
                    break;
                }
                if (min == 1) return 1;
            }
        }
        return Integer.MAX_VALUE == min ? 0 : min;
    }
}
